Class NetworkFileImpl

java.lang.Object
com.cisco.pt.ipc.impl.IPCObjectImpl
com.cisco.pt.ipc.system.impl.NetworkFileImpl
All Implemented Interfaces:
IPCObject, NetworkFile
Direct Known Subclasses:
ActivityFileImpl

public class NetworkFileImpl extends IPCObjectImpl implements NetworkFile
Information provided by the PKI file:

    \class NetworkFile
    
    \brief NetworkFile is the main system file for the application. It holds all the configurations for the engine as well as the UI.
    
    \example appWindow().getActiveFile()
    
Author:
Auto-generated
  • Constructor Details

  • Method Details

    • getSavedFilename

      public String getSavedFilename()
      Information provided by the PKI file:
      
          \brief Returns the filename of the currently opened file.
          
          \return QString, the filename of the currently opened file.
          
              
      Specified by:
      getSavedFilename in interface NetworkFile
      Returns:
      String Returns a String
    • getVersion

      public String getVersion()
      Information provided by the PKI file:
      
          \brief Returns the version the current file was saved in.
          
          \return QString, the version the current file was saved in.
          
              
      Specified by:
      getVersion in interface NetworkFile
      Returns:
      String Returns a String
    • getNetworkDescription

      public String getNetworkDescription()
      Information provided by the PKI file:
      
          \brief Returns the network description of the current file.
          
          \return QString, the network description.
          
              
      Specified by:
      getNetworkDescription in interface NetworkFile
      Returns:
      String Returns a String
    • setNetworkDescription

      public void setNetworkDescription(String description)
      Information provided by the PKI file:
      
          \brief Sets the network description for the current file.
          
          \param description, the network description for the current file.
          
              
      Specified by:
      setNetworkDescription in interface NetworkFile
      Parameters:
      description - Takes in a parameter of description
    • getOptions

      public Options getOptions()
      Information provided by the PKI file:
      
          \brief Returns the option settings of the current file.
          
          \return Options, the Options object of the current file.
          
              
      Specified by:
      getOptions in interface NetworkFile
      Returns:
      Options Returns a Options
    • getMainNetwork

      public Network getMainNetwork()
      Information provided by the PKI file:
      
          \brief Returns the network of the current file.
          
          \return Network, the Network object of the current file.
          
              
      Specified by:
      getMainNetwork in interface NetworkFile
      Returns:
      Network Returns a Network
    • getUserProfile

      public UserProfile getUserProfile()
      Information provided by the PKI file:
      
          \brief Returns the user profile of the current file.
          
          \return UserProfile, the UserProfile object of the current file.
          
              
      Specified by:
      getUserProfile in interface NetworkFile
      Returns:
      UserProfile Returns a UserProfile
    • getMainSimulation

      public Simulation getMainSimulation()
      Information provided by the PKI file:
      
          \brief Returns the simulation of the current file.
          
          \return Simulation, the Simulation object of the current file.
          
              
      Specified by:
      getMainSimulation in interface NetworkFile
      Returns:
      Simulation Returns a Simulation
    • getWorkspace

      public Workspace getWorkspace()
      Information provided by the PKI file:
      
          \brief Returns the workspace of the current file.
          
          \return Workspace, the Workspace object of the current file.
          
              
      Specified by:
      getWorkspace in interface NetworkFile
      Returns:
      Workspace Returns a Workspace
    • getActivityScriptEngine

      public ActivityScriptEngine getActivityScriptEngine()
      Information provided by the PKI file:
      
          \brief Returns the activity script engine of the current file.
          
          \return ActivityScriptEngine, the ActivityScriptEngine object of the current file.
          
              
      Specified by:
      getActivityScriptEngine in interface NetworkFile
      Returns:
      ActivityScriptEngine Returns a ActivityScriptEngine
    • getScriptEngine

      public ActivityScriptEngine getScriptEngine()
      Information provided by the PKI file:
      
          \brief Returns the script engine of the current file.
          
          \return ActivityScriptEngine, the ActivityScriptEngine object of the current file.
          
              
      Specified by:
      getScriptEngine in interface NetworkFile
      Returns:
      ActivityScriptEngine Returns a ActivityScriptEngine
    • resetScriptEngine

      public void resetScriptEngine()
      Information provided by the PKI file:
      
          \brief Removes the current activity script engine and creates a new one.
          
          \remark All loaded script results will be lost.
          
              
      Specified by:
      resetScriptEngine in interface NetworkFile
    • addScript

      public boolean addScript(String id, String contents)
      Information provided by the PKI file:
      
          \brief Adds a script to the activity file.
          
          \param id, the ID (e.g. filename) of the the script.
          \param contents, the content of the script.
          
          \return bool, true if successful, otherwise false.
          
              
      Specified by:
      addScript in interface NetworkFile
      Parameters:
      id - Takes in a parameter of id
      contents - Takes in a parameter of contents
      Returns:
      boolean Returns a boolean
    • addScriptFile

      public boolean addScriptFile(String id, String filename)
      Information provided by the PKI file:
      
          \brief Adds the script contents to the activity file from a file path.
          
          \param id, the ID (e.g. filename) of the the script.
          \param filename, the path including the filename of the script.
          
          \remark The script is not evaluated immediately.
          
          \return bool, true if the script was successfully added, false if not.
          
              
      Specified by:
      addScriptFile in interface NetworkFile
      Parameters:
      id - Takes in a parameter of id
      filename - Takes in a parameter of filename
      Returns:
      boolean Returns a boolean
    • addDefaultScripts

      public void addDefaultScripts()
      Information provided by the PKI file:
      
          \brief Resets the scripts to the default scripts.
          
          \remark Missing script files will be addded, existing scripts of the same name will be overwritten.
          
              
      Specified by:
      addDefaultScripts in interface NetworkFile
    • removeScript

      public boolean removeScript(String id)
      Information provided by the PKI file:
      
          \brief Removes the specified script from the activity file hash.
          
          \param id, the ID (e.g. filename) of the script.
          
          \return bool, true if successful, otherwise false.
          
          \remark This will not remove the script contents from memory. However, upon the next resetScriptEngine(), the removed script will not be loaded.
          
              
      Specified by:
      removeScript in interface NetworkFile
      Parameters:
      id - Takes in a parameter of id
      Returns:
      boolean Returns a boolean
    • getScript

      public String getScript(String id)
      Information provided by the PKI file:
      
          \brief Returns the content of the script with the specified ID.
          
          \param id, the ID (e.g. filename) of the script.
          
          \return QString, the content of the script with the specified ID.
          
              
      Specified by:
      getScript in interface NetworkFile
      Parameters:
      id - Takes in a parameter of id
      Returns:
      String Returns a String
    • getScriptIDs

      public List<String> getScriptIDs()
      Information provided by the PKI file:
      
          \brief Returns the list of IDs currently in the system.
          
          \return vector<QString>, the list of IDs currently in the system.
          
              
      Specified by:
      getScriptIDs in interface NetworkFile
      Returns:
      List<String> Returns a List<String>
    • addScriptDataStore

      public boolean addScriptDataStore(String id, String contents)
      Information provided by the PKI file:
      
          \brief Adds script data store for persistent storage (e.g. constants, options, settings).
          
          \param id, the ID (e.g. name) of the data store.
          \param contents, the content of the data store.
          
          \return bool, true if successful, otherwise false.
          
              
      Specified by:
      addScriptDataStore in interface NetworkFile
      Parameters:
      id - Takes in a parameter of id
      contents - Takes in a parameter of contents
      Returns:
      boolean Returns a boolean
    • removeScriptDataStore

      public boolean removeScriptDataStore(String id)
      Information provided by the PKI file:
      
          \brief Removes the specified script data store for persistent storage (e.g. constants, options, settings).
          
          \param id, the ID (e.g. name) of the data store of interest.
          
          \return bool, true if successful, otherwise false.
          
              
      Specified by:
      removeScriptDataStore in interface NetworkFile
      Parameters:
      id - Takes in a parameter of id
      Returns:
      boolean Returns a boolean
    • getScriptDataStore

      public String getScriptDataStore(String id)
      Information provided by the PKI file:
      
          \brief Returns the content of the specified script data store.
          
          \param id, the ID (e.g. name) of the data store of interest.
          
          \return QString, the content of the specified script data store.
          
              
      Specified by:
      getScriptDataStore in interface NetworkFile
      Parameters:
      id - Takes in a parameter of id
      Returns:
      String Returns a String
    • getScriptDataStoreIDs

      public List<String> getScriptDataStoreIDs()
      Information provided by the PKI file:
      
          \brief Returns the list of IDs of script data stores.
          
          \return vector<QString>, the list of IDs of script data stores.
          
              
      Specified by:
      getScriptDataStoreIDs in interface NetworkFile
      Returns:
      List<String> Returns a List<String>
    • getFilterSet

      public FilterSet getFilterSet()
      Information provided by the PKI file:
      
          \brief Returns the engine filter set for simulation packets, what is filtered out.
          
          \return FilterSet, the filter set.
          
              
      Specified by:
      getFilterSet in interface NetworkFile
      Returns:
      FilterSet Returns a FilterSet
    • addCustomTrafficType

      public boolean addCustomTrafficType(String customType)
      Information provided by the PKI file:
      
          \brief Adds a custom traffic type. Returns true if successful, false otherwise.
          
          \return bool, true if successfully added the custom traffic type, otherwise false.
          
              
      Specified by:
      addCustomTrafficType in interface NetworkFile
      Parameters:
      customType - Takes in a parameter of customType
      Returns:
      boolean Returns a boolean
    • hasCustomTrafficType

      public boolean hasCustomTrafficType(String customType)
      Information provided by the PKI file:
      
          \brief Returns whether a custom traffic type is already added.
          
          \return bool, true the custom traffic type is already added, otherwise false.
          
              
      Specified by:
      hasCustomTrafficType in interface NetworkFile
      Parameters:
      customType - Takes in a parameter of customType
      Returns:
      boolean Returns a boolean
    • addCustomPduType

      public boolean addCustomPduType(String customPduType, String jsonDefinition)
      Information provided by the PKI file:
      
          \brief Adds a custom PDU type. Returns true if successful, false otherwise.
          
          \param customPduType, the custom PDU type name.
          \param jsonDefinition, a JSON string representing the definition of the PDU
          in the following format and must include the following:
          {
          "title": "My Protocol PDU",
          "units": "Bits",
          "unit_marks": [16],
          "width": 32,
          "fields": [{"value": "TYPE: {type}","size": 32},
          {"value": "data: {data}","size": 32}]
          
          \return bool, true if successfully added the custom PDU type, otherwise false.
          
              
      Specified by:
      addCustomPduType in interface NetworkFile
      Parameters:
      customPduType - Takes in a parameter of customPduType
      jsonDefinition - Takes in a parameter of jsonDefinition
      Returns:
      boolean Returns a boolean
    • hasCustomPduType

      public boolean hasCustomPduType(String customPduType)
      Information provided by the PKI file:
      
          \brief Returns whether a custom PDU type is already added.
          
          \return bool, true the custom traffic PDU is already added, otherwise false.
          
              
      Specified by:
      hasCustomPduType in interface NetworkFile
      Parameters:
      customPduType - Takes in a parameter of customPduType
      Returns:
      boolean Returns a boolean
    • isActivityFile

      public boolean isActivityFile()
      Information provided by the PKI file:
      
          \brief Returns whether this file is an activity file or regular network file
          
              
      Specified by:
      isActivityFile in interface NetworkFile
      Returns:
      boolean Returns a boolean